/**
 * 短消息提示加载
 */

//页面载入初始化
$( "body" ).ready( function( e )
{
	setTimeout( "load_msg_data()", 3000 );
} );

function load_msg_data()
{
	var msger = get_msger();

	$.post( contextPath+"/index/remind_date.json", null, function( value )
	{
		var d = value.list;
		if(d.length>0){
			var a = value.clist;
			for( var i = 0; i < d.length; i++ ){
				v = d[ i ];
				
					var name = a[i].nickname;
				msger.msg( "<b>[定时提醒]</b> <a>客户跟踪   ["+a[i].nickname+"]</a>", function( e ){
					var checkbox = e.data.self.find( "input:checkbox" );
					if( e.data.type == '问卷客户' ){
						client_opening( e.data.client );
					}
					else{
						tracking_opening( e.data.client );
					}
					checkbox.prop( "checked" ) && msg_read_sign( e.data.key );
				}, v );
				
			}
			msger.open( "消息提醒" );
		}
	} );
}

function msg_read_sign( key )
{
	$.post( "consultant_msg_sign.php", {
		key: key
	}, function( value )
	{
	} );
}

function tracking_opening( key )
{
	if( !empty( key ) )
		$( '#content_container' ).attr( 'src', contextPath+'/index/consultant_client.htm?keyname='+key );
}

function client_opening( key )
{
	if( !empty( key ) )
		$( '#content_container' ).attr( 'src', 'consultant_client.php?key=' + key );
}
